#include <iostream>
#include <string>
#include <algorithm>
using namespace std;

bool IsPalindrome(string& s)
{
    int left = 0;
    int right = s.size() - 1;
    while(left <= right){
        if(s[left] == s[right]){
            left++;
            right--;
        }
        else{
            break;
        }
    }
    if(left < right){
        return false;
    }
    return true;
}

int main()
{
    string sa,sb;
    cin >> sa >> sb;
    int cnt = 0;
    for(int i = 0; i <= sa.size(); ++i){  // i = 0时头插， i = size时尾插
        string temp = sa;
        temp.insert(i, sb);
        if(IsPalindrome(temp)){
            cnt++;
        }
    }
    cout << cnt;
    return 0;
}